From c5619cba8c931f1b57963810fafbc77521598ca2 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 30 Dec 2016 12:19:34 +1300 Subject: [PATCH] review changes, round 2 part b Remove the ContinueBuild concept, be lenient about missing files in all cases, and undo the fingerprint changes (not an issue now we're not stopping the build early). --- src/cargo/ops/cargo_rustc/fingerprint.rs | 13 ++++-- src/cargo/ops/cargo_rustc/mod.rs | 59 ++++++++++-------------- src/cargo/ops/mod.rs | 2 +- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index dde13d4c2..812240908 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -148,10 +148,15 @@ impl Fingerprint { fn update_local(&self) -> CargoResult<()> { match self.local { LocalFingerprint::MtimeBased(ref slot, ref path) => { - if let Ok(meta) = fs::metadata(path) { - let mtime = FileTime::from_last_modification_time(&meta); - *slot.0.lock().unwrap() = Some(mtime); - } + let meta = fs::metadata(path).chain_error(|| { + internal(format!("failed to stat `{}`", path.display())) + })?; + let mtime = FileTime::from_last_modification_time(&meta); + *slot.0.lock().unwrap() = Some(mtime); + // if let Ok(meta) = fs::metadata(path) { + // let mtime = FileTime::from_last_modification_time(&meta); + // *slot.0.lock().unwrap() = Some(mtime); + // } } LocalFingerprint::Precalculated(..) => return Ok(()) } diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 0862a296c..adbdbedc3 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -62,9 +62,9 @@ pub trait Executor: Send + Sync + 'static { fn init(&self, _cx: &Context) {} /// If execution succeeds, the ContinueBuild value indicates whether Cargo /// should continue with the build process for this package. - fn exec(&self, cmd: ProcessBuilder, _id: &PackageId) -> Result { + fn exec(&self, cmd: ProcessBuilder, _id: &PackageId) -> Result<(), ProcessError> { cmd.exec()?; - Ok(ContinueBuild::Continue) + Ok(()) } fn exec_json(&self, @@ -72,9 +72,9 @@ pub trait Executor: Send + Sync + 'static { _id: &PackageId, handle_stdout: &mut FnMut(&str) -> CargoResult<()>, handle_srderr: &mut FnMut(&str) -> CargoResult<()>) - -> Result { + -> Result<(), ProcessError> { cmd.exec_with_streaming(handle_stdout, handle_srderr)?; - Ok(ContinueBuild::Continue) + Ok(()) } } @@ -85,12 +85,6 @@ pub struct DefaultExecutor; impl Executor for DefaultExecutor {} -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum ContinueBuild { - Continue, - Stop, -} - // Returns a mapping of the root package plus its immediate dependencies to // where the compiled libraries are all located. pub fn compile_targets<'a, 'cfg: 'a>(ws: &Workspace<'cfg>, @@ -258,7 +252,6 @@ fn rustc(cx: &mut Context, unit: &Unit, exec: Arc) -> CargoResult) -> CargoResult) -> CargoResult